﻿<Card Class="users-table-root">
    <CardContent Class="users-table-content">
        <div class="users-table-inner">
            <Table>
                <TableHead>
                    <TableRow>
                        <TableCell Padding="@Padding.Checkbox">
                        <Checkbox
                            DefaultChecked="false"
                            Color="@Color.Primary"
                            Indeterminate="false" />
                        </TableCell>
                        <TableCell>Name</TableCell>
                        <TableCell>Email</TableCell>
                        <TableCell>Location</TableCell>
                        <TableCell>Phone</TableCell>
                        <TableCell>Registration date</TableCell>
                    </TableRow>
                </TableHead>
                <TableBody>
                @foreach(var user in Users)
                {
                    <TableRow
                        @key="@user"
                        Class="users-table-row"
                        Hover
                        Selected="false">
                        <TableCell Padding="@Padding.Checkbox">
                            <Checkbox
                                DefaultChecked="false"
                                Color="@Color.Primary" />
                        </TableCell>
                        <TableCell>
                            <div class="users-table-name-container">
                                <Avatar
                                    Class="users-table-avatar"
                                    Src="@user.Avatar">
                                    @user.Name[0]
                                </Avatar>
                                <Typography
                                    Variant="@TypographyVariant.Body1">
                                    @user.Name
                                </Typography>
                            </div>
                        </TableCell>
                        <TableCell>@user.Email</TableCell>
                        <TableCell>
                            @user.Address.City, @user.Address.State, @user.Address.Country
                        </TableCell>
                        <TableCell>@user.Phone</TableCell>
                        <TableCell>
                            @user.CreatedAt.ToString("dd/mm/yyyy")
                        </TableCell>
                    </TableRow>
                }
                </TableBody>
            </Table>
        </div>
    </CardContent>
</Card>

@code
{
    [Parameter]
    public IEnumerable<User> Users { set; get; }
}